ErrorHandler
ScrapComputer's Computer API is qutie big, So this error handler is used for the Computer API's function error handling. Use this for your functions, its quite powerful!
Functions
assert
sm.scrapcomputers.errorHandler.assert( value, argumentIndex, str, ... )
A better assert function
Arguments:
- value [ any ] The value to check
- argumentIndex [ integer? ]The index where this value was
- str [ string ] The message when it errors
- ... [ any[] ] The arguments for str
assertArgument
sm.scrapcomputers.errorHandler.assertArgument( value, argumentIndex, allowedTypes, nameOverwrites )
A assert function for function arguments!
Arguments:
- value [ any ] The value to check
- argumentIndex [ number? ] If your function has multiple arguments, fill this with the argument index, So let say your checking the 3rd argument. Set this to 3.
- allowedTypes [ type[] ] Contains all allowed types
- nameOverwrites [ string[]? ] This lets you modify the error message arguments. Basicly the words afther Expected. If you dont want to modify a argument name, Set that value in the table to nil and else a string.